/*
 * @Author: miaoyongbin
 * @Date: 2022-07-21 10:22:53
 * @LastEditTime: 2022-07-21 10:22:53
 * @Description:
 *
 * Copyright (c) 2022 by miaoyongbin, All Rights Reserved.
 */
/*
 * @Author: miaoyongbin
 * @Date: 2022-07-21 10:22:09
 * @LastEditTime: 2022-07-21 10:22:10
 * @Description:
 *
 * Copyright (c) 2022 by miaoyongbin, All Rights Reserved.
 */

import request from '@/utils/request'
import { camelCaseObject } from '@/libs/object'

const AUTH_PREFIX_V1 = `/api/v1/ob`

export function getObTenantList(params) {
  return request.get(`${AUTH_PREFIX_V1}/tenants`, { params }).then(res => camelCaseObject(res))
}

export function getObTenantListByPage(params) {
  return request.get(`${AUTH_PREFIX_V1}/tenants/page`, { params }).then(res => camelCaseObject(res))
}

export function getObTenant(tenantId) {
  return request.get(`${AUTH_PREFIX_V1}/tenants/${tenantId}`).then(res => camelCaseObject(res))
}

export function createObTenant(params) {
  return request.post(`${AUTH_PREFIX_V1}/tenants`, params).then(res => camelCaseObject(res))
}

export function updateObTenant(tenantId, params) {
  return request.put(`${AUTH_PREFIX_V1}/tenants/${tenantId}`, params).then(res => camelCaseObject(res))
}

export function deleteObTenant(tenantId) {
  return request.delete(`${AUTH_PREFIX_V1}/tenants/${tenantId}`).then(res => camelCaseObject(res))
}
